#include<iostream>
using namespace std;
int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int t1, t2;
    t1 = a * 60 + b;
    t2 = c * 60 + d;
    int t = t2 - t1;
    int e, f;
    e = t / 60;
    f = t % 60;
    cout << e << " " << f << endl;
    return 0;
}